package com.platform.qujia.service.impl;

import com.platform.qujia.service.WxTemplateParamsGeneral;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component("WxTemplateCreateActivity")
public class WxTemplateCreateActivityParams implements WxTemplateParamsGeneral {
    @Override
    public void setWxTemplateContent(List<String> contents, Map<String, String> templateParams, Map<String, Map<String, String>> data) {
        if (contents.contains("活动内容")) {
            data.put("thing6", Collections.singletonMap("value", templateParams.get("content")));
        }

        String stationName = templateParams.get("stationName");
        if(stationName.length()>20){
            stationName=stationName.substring(0,17)+"...";
            templateParams.put("stationName",stationName);
        }

            data.put("thing2", Collections.singletonMap("value", templateParams.get("stationName")));
    }
}
